﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TaskBasedSchedule.Core
{
    public class AuthorityList : IEnumerable<Authority>
    {
        private List<Authority> _authorities = new List<Authority>(16);

        public Authority this[int index]
        {
            get
            {
                return _authorities[index];
            }
            internal set
            {
                _authorities[index] = value;
            }
        }

        public int Count { get { return _authorities.Count; } }

        internal void InternalAdd(Authority authority)
        {
            _authorities.Add(authority);
        }

        internal void InternalRemove(Authority authority)
        {
            _authorities.Remove(authority);
        }

        internal void InternalRemove(int index)
        {
            _authorities.RemoveAt(index);
        }

        public IEnumerator<Authority> GetEnumerator()
        {
            return _authorities.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return _authorities.GetEnumerator();
        }
    }
}